home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / windows / ddelib / ddedemos.prn < prev    next >
Encoding:
Text File  |  1990-09-17  |  6.3 KB  |  178 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                             Dynamic Data Exchange Demos
  10.  
  11.  
  12.                              Horizon Technologies Inc.
  13.  
  14.  
  15.             Overview:
  16.  
  17.  
  18.             The Dynamic Data Exchange (DDE) demo programs illustrate the
  19.  
  20.               concept of inter-program communications in a Microsoft
  21.  
  22.               Windows environment.  Source code for three programs is
  23.  
  24.               included.  All interactions between these programs are
  25.  
  26.               accomplished via the process of message passing in
  27.  
  28.               accordance with the DDE protocol defined by Microsoft.  A
  29.  
  30.               dynamic link library, DDELIB, developed by Horizon
  31.  
  32.               Technologies Inc., has been utilized in each of these
  33.  
  34.               programs to significantly reduce development time and
  35.  
  36.               program complexity.  The following material builds upon
  37.  
  38.               the information presented in the Overview of the  DDELIB
  39.  
  40.               documentation.
  41.  
  42.  
  43.  
  44.             AccExcel:
  45.  
  46.  
  47.  
  48.             ACCEXCEL is a menu driven application that shows the basics
  49.  
  50.               of a DDE connection to EXCEL.  EXCEL is a popular Windows
  51.  
  52.               spreadsheet application written by Microsoft.  The
  53.  
  54.               ACCEXCEL pull-down menu "DDE" lists four items; Initiate,
  55.  
  56.               Poke, Advise and Terminate.
  57.  
  58.  
  59.             Initiate will establish a DDE session with a spreadsheet in
  60.  
  61.               EXCEL.  The name of the spreadsheet is entered into a
  62.  
  63.               dialog box presented by ACCEXCEL.  Poke will send data to
  64.  
  65.               the spreadsheet.  A dialog box will allow the
  66.  
  67.               specification of the cell range and the comma separated
  68.  
  69.               data values.  Advise will set up an advise circuit with a
  70.  
  71.               cell range in EXCEL.  When any data is modified in this
  72.  
  73.               range, EXCEL will advise ACCEXCEL which in turn will
  74.  
  75.               display a message box with the modified data.  Terminate
  76.  
  77.               simply closes the DDE session established with Initiate.
  78.  
  79.  
  80.  
  81.             Sub:
  82.  
  83.  
  84.  
  85.             SUB is a DDE client application that talks to the server
  86.  
  87.               application FISH.  FISH, supplied by Microsoft, displays
  88.  
  89.               fish swimming in a tank.  When FISH establishes a session
  90.  
  91.               with a client, it reveals a yellow submarine.  This
  92.  
  93.               submarine can then be manipulated by the client to move
  94.  
  95.               up, down, left, right and even fire a torpedo.  To
  96.  
  97.  
  98.          DDE DEMOS - Copyright (C) September 12, 1990 Horizon
  99.  
  100.          Technologies Inc.  All rights reserved.  (517) 347-0800    Page 1
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.               augment this capability, the client can also obtain the
  108.  
  109.               current position of a fish in x,y coordinates.  With a
  110.  
  111.               simple sneak-up-from-behind-and-fire strategy, SUB easily
  112.  
  113.               controls the submarine in a mission to liquidate fish.
  114.  
  115.  
  116.             Technically, SUB initiates two sessions with fish;  one for
  117.  
  118.               sub control and reporting, the other for fish position
  119.  
  120.               monitoring.  A DDE advise circuit for fish number zero is
  121.  
  122.               established.  The callback routine Fish() is called by
  123.  
  124.               DDELIB every time the fish moves.  In this routine, a
  125.  
  126.               request for the current sub position is made.  This
  127.  
  128.               results in a callback to the Sub() routine.  Once the
  129.  
  130.               current fish and sub positions are known, a call to
  131.  
  132.               MoveSub() is made.  Here, a command is sent to the sub
  133.  
  134.               for positioning and firing.  Note that the sub must be
  135.  
  136.               moving up or down, left or right.  Therefore, if the sub
  137.  
  138.               needs to maintain elevation, it must oscillate up and
  139.  
  140.               down.
  141.  
  142.  
  143.  
  144.             Session and SessUtil:
  145.  
  146.  
  147.  
  148.             SESSION is a DDE server application that provides a means
  149.  
  150.               for clients to store and retrieve string variable
  151.  
  152.               contents by name.  SESSION accepts DDE pokes, requests,
  153.  
  154.               and advises.  Commands are not supported.
  155.  
  156.  
  157.             SESSION accomplishes this by registering the topic
  158.  
  159.               Variables.  The callback routine Session() is invoked by
  160.  
  161.               DDELIB every time a new client establishes a session,
  162.  
  163.               terminates a session, pokes or requests data, establishes
  164.  
  165.               an advise circuit, or sends a command.  SESSION processes
  166.  
  167.               these events to provide its services, such as saving the
  168.  
  169.               contents of a poke or advising a client of a change in
  170.  
  171.               the variable.
  172.  
  173.  
  174.             SESSUTIL is a DDE client application that communicates with
  175.  
  176.               the SESSION application.  SESSUTIL shows the current
  177.  
  178.               contents of the User variable, as provided by SESSION, on
  179.  
  180.               its client area.  The user can set the contents of the
  181.  
  182.               User variable by selecting the ______
  183.                                              Modify item from the ____
  184.                                                                   File
  185.  
  186.               menu.  The new value is displayed on every instance of
  187.  
  188.               SESSUTIL running.
  189.  
  190.  
  191.             SESSUTIL initially establishes a DDE advise circuit with
  192.  
  193.               SESSION on the variable User.  This causes the callback
  194.  
  195.               routine User() to be invoked by DDELIB whenever SESSION
  196.  
  197.               performs an advise.  User() will update its own copy of
  198.  
  199.               the value and then force a repaint of the client area,
  200.  
  201.               resulting in the new value of the User variable to be
  202.  
  203.  
  204.          DDE DEMOS - Copyright (C) September 12, 1990 Horizon
  205.  
  206.          Technologies Inc.  All rights reserved.  (517) 347-0800    Page 2
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.               displayed.  When the user selects OK from the modify
  214.  
  215.               dialog box, the Poke() routine is called.  This sends the
  216.  
  217.               new variable to SESSION, which in turn advises SESSUTIL,
  218.  
  219.               which then displays the new value.
  220.  
  221.  
  222.             Microsoft Word for Windows can eavesdrop in on the
  223.  
  224.               conversation, displaying the current contents of the User
  225.  
  226.               variable.  Simply insert a field of the form {ddeauto
  227.  
  228.               SESSION Variables User}.
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.          DDE DEMOS - Copyright (C) September 12, 1990 Horizon
  274.  
  275.          Technologies Inc.  All rights reserved.  (517) 347-0800    Page 3